package com.fhz.day005.test

/**
 * 时间:2021/10/19
 * @author msfeng
 * 简述: TODO
 */
class SubSubject : Subject{
    //观察者集合
    private var list = mutableListOf<Observer>()

    override fun attach(observer: Observer) {
        list.add(observer)
    }

    override fun detach(observer: Observer) {
        list.remove(observer)
    }

    override fun notify(string: String) {
        list.forEach {
            it.receive(string)
        }
    }
}